package org.jypj.dev.task;

import org.jypj.dev.dao.ITrainWorkDao;
import org.jypj.dev.service.ITrainWorkService;
import org.jypj.dev.util.DateUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by ChenYu on 2017-04-07.
 */
@Component
public class TrainWorkTask {

    @Resource
    private ITrainWorkService trainWorkService;

    /**
     * 计算用户车次分数
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void updateTrainWorkValid() {
        try {
            String todayString = DateUtils.getTodayString("yyyy-MM-dd");
            System.out.println(todayString);
            trainWorkService.updateTrainWorkValid(todayString);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
